
<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
    // This tests RebalanceWhitespace's ability to Undo.
    test(() => assert_selection(
        [
            '<div contenteditable style="word-wrap: break-word;">',
                '<div>( |)</div>',
            '</div>',
        ].join(''),
        selection => {
            Array.of('this is a test. ').forEach(character => {
                selection.document.execCommand('insertText', false, character);
            });
            selection.document.execCommand('undo');
            selection.document.execCommand('redo');
            selection.document.execCommand('undo');
            selection.document.execCommand('redo');
        },
        [
            '<div contenteditable style="word-wrap: break-word;">',
                '<div>( this is a test. |)</div>',
            '</div>',
        ].join('')),
        'Redo Typing can add extra space characters');
</script>
